package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.jsgl.*;
import com.tfswx.fljdmxyy.query.jsgl.JsxxQueryResult;
import com.tfswx.fljdmxyy.service.JsglService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 角色管理
 *
 * @Author 陈文佳
 * @Date 2023/03/24
 */
@Api(tags = "角色管理")
@RequestMapping("api/zzjg")
@RestController
public class JsglController {

    @Resource
    private JsglService jsglService;

    @ApiOperation("新增角色信息")
    @PostMapping("/addJsxx")
    public JsxxAddOutputDTO addJsxx(@RequestBody @Validated JsxxAddInputDTO dto) {
        return jsglService.addJsxx(dto);
    }

    @ApiOperation("修改角色信息")
    @PostMapping("/updateJsxx")
    public Boolean updateJsxx(@RequestBody @Validated JsxxUpdateInputDTO dto) {
        return jsglService.updateJsxx(dto);
    }

    @ApiOperation("查询所有角色")
    @PostMapping("/queryJsxx")
    public List<JsxxQueryResult> queryJsxx() {
        return jsglService.queryJsxx();
    }

    @ApiOperation("查询角色")
    @PostMapping("/getJsxx")
    public JsxxGetOutputDTO getJsxx(@RequestBody @Validated JsxxGetInputDTO param) {
        return jsglService.getJsxx(param);
    }

    @ApiOperation("删除角色信息")
    @PostMapping("/deleteJsxx")
    public Boolean deleteJsxx(@RequestBody @Validated JsxxDeleteInputDTO dto) {
        return jsglService.deleteJsxx(dto);
    }
}
